package com.sanyuan.cloud.module.system.controller.app.user;

import com.sanyuan.cloud.framework.common.enums.CommonStatusEnum;
import com.sanyuan.cloud.framework.common.enums.NongmoUserTypeEnum;
import com.sanyuan.cloud.framework.common.pojo.CommonResult;
import com.sanyuan.cloud.module.system.dal.dataobject.user.AdminUserDO;
import com.sanyuan.cloud.module.system.service.user.AdminUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static com.sanyuan.cloud.framework.common.pojo.CommonResult.success;

/**
 * @Description: UserController
 * @Author: wuyuwei
 * @Date: 2025/3/31
 */
@Tag(name = "小程序 - 用户")
@RequestMapping("/system/miniapp")
@RestController
public class MiniAppUserController {

    @Resource
    private AdminUserService userService;

    @GetMapping({"/getUserList"})
    @Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户，主要用于前端的下拉选项")
    public CommonResult<List<AdminUserDO>> getUserList() {
        return success(userService.getListByStatusAndIsAdmin(CommonStatusEnum.ENABLE.getStatus(), NongmoUserTypeEnum.MEMBER.getValue()));
    }
}
